package assembler

import (
	"example.com/m/v2/internal/domain/account_aggregate/entity"
	"example.com/m/v2/internal/interfaces/dto"
)

func ConvertToMainAccountDto(entity *entity.MainAccountEntity) *dto.MainAccountDto {
	if entity == nil {
		return nil
	}
	return &dto.MainAccountDto{
		Id:          entity.Id,
		Nickname:    entity.Nickname,
		Avatar:      entity.Avatar,
		PhoneNumber: entity.PhoneNumber,
		Email:       entity.Email,
		Address: dto.AddressValueObjectDto{
			Province: entity.Address.Province,
			Block:    entity.Address.Block,
			Unit:     entity.Address.Unit,
		},
		CreateTime: entity.CreateTime,
	}
}
